/**
 * Copyright 2008-2009. Chongqing Communications Industry Services Co.,Ltd Information Technology Branch. All rights
 * reserved. <a>http://www.cqcis.com</a>
 */
package com.cqcis.uip.base.framework.utils;

import java.util.HashMap;
import java.util.Map;

import com.cqcis.uip.base.framework.common.Task;
import com.cqcis.uip.base.framework.core.RegisteredService;

/**
 * WS Client Current Task
 * 
 * @author huangmy
 * @date   2008-11-3
 */
public class WSClientThreadLocalTask {
	private static Map<RegisteredService, Task> currentTasks = new HashMap<RegisteredService, Task>();

	/**
	 * 设置
	 * 
	 * @param record
	 */
	@SuppressWarnings("unchecked")
	public static void setTask(RegisteredService rs, Task task) {
		currentTasks.put(rs, task);
	}
	
	/**
	 * 删除
	 * 
	 * @param rs
	 * @return
	 */
	public static Task removeTask(RegisteredService rs) {
		return currentTasks.remove(rs);
	}
    
	/**
	 * 获取
	 * 
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public static Task getTask(RegisteredService rs) {
		return currentTasks.get(rs);
	}
}
